﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using IBM.Data.DB2;

public partial class 连接DB2测试 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //获取连接DB2的字符串
        string DB2ConnectionString = ConfigurationManager.ConnectionStrings["DB2"].ConnectionString;
        //新建一个DataTable
        DataTable result = new DataTable();

        string proname = "ZXGZTJ_PG";
        string fffydm = "0";
        string ffydm = "2760";
        string fydm = "0";
        string cbspt = "0";
        string tjksrq = "2000-12-12";
        string tjjsrq = "2012-12-12";

        DataTable dt = new DataTable();
        //新建一个DB2连接
        DB2Connection con = new DB2Connection(DB2ConnectionString);

        DB2Command cmd = new DB2Command();

        cmd.Connection = con;

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = proname;
        cmd.Parameters.Add("fffydm", fffydm);
        cmd.Parameters.Add("ffydm", ffydm);
        cmd.Parameters.Add("fydm", fydm);
        cmd.Parameters.Add("cbspt", cbspt);
        cmd.Parameters.Add("tjksrq", tjksrq);
        cmd.Parameters.Add("tjjsrq", tjjsrq);

        DB2DataAdapter adt = new DB2DataAdapter(cmd);
        adt.Fill(dt);

        cmd.Connection.Close();

        try
        {
            Repeater1.DataSource = dt;
            Repeater1.DataBind();
        }
        catch (Exception ex) { dt = null; }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        
    }
}
